package View;
import javax.swing.JPanel;
import javax.swing.JTabbedPane;

import net.miginfocom.swing.MigLayout;
import java.awt.Button;


public class MainPanel extends JPanel{
	
	private InputPanel inputPanel;
	private JTabbedPane graphTabbedPane;
	private OutputTable outputTable;
	private BisectionGraph bisectionGraph;
	private NewtonGraph newtonGraph;
	private JPanel leftPanel;
	private JPanel rightPanel;
	
	public MainPanel(){
		setLayout(new MigLayout());
		
		initComponent();
		addComponenet();
		
	}

	private void initComponent() {
		inputPanel = new InputPanel();
		outputTable = new OutputTable();
		bisectionGraph = new BisectionGraph();
		newtonGraph = new NewtonGraph();
	
		graphTabbedPane = new JTabbedPane();
		graphTabbedPane.add("Bisection Method", bisectionGraph);
		graphTabbedPane.add("Newton Method", newtonGraph);
		
		leftPanel = new JPanel();
		leftPanel.setLayout(new MigLayout());
		rightPanel = new JPanel();
		rightPanel.setLayout(new MigLayout());
	}

	private void addComponenet() {
		
		leftPanel.add(inputPanel, "wrap");
		leftPanel.add(outputTable);
		rightPanel.add(graphTabbedPane);
		
		add(leftPanel);
		add(rightPanel);
	}
	public InputPanel getInputPanel() {
        return inputPanel;
    }
    
    public OutputTable getOutputTable() {
        return outputTable;
    }
    public NewtonGraph getNewtonGraph(){
    	return newtonGraph;
    }
    public BisectionGraph getBisectionGraph(){
    	return bisectionGraph;
    }
}
